<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    if (session.getAttribute("sUsuario") == null) {
        response.sendRedirect("usuario?ac=li");
    }
    response.addHeader("Cache-Control", "max-age = 0, s-maxage = 0,must-revalidate, proxy-revalidate, no-cache, no-store ");
    response.addHeader("Pragma", "no-cache");
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="author" content="Moises Canche Tzab - Sybil Integraciones TI">
        <link rel="shortcut icon" href="images/favicon.ico">
        <script type="text/javascript" src="js/generico.js"> </script>
        <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.10.2.custom.js"></script>
        <script type="text/javascript" src="js/jscal2.js"></script>
        <script type="text/javascript" src="js/lang/es.js"></script>
        
        <link rel="stylesheet" type="text/css" href="css/generico.css">
        <link rel="stylesheet" type="text/css" href="css/jscal2.css">
        <link rel="stylesheet" type="text/css" href="css/border-radius.css">
        <link rel="stylesheet" type="text/css" href="css/steel/steel.css">
        <link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.10.2.custom.css">
        <title>SSYMA</title>
        <script type='text/javascript'>
            $.ajaxSetup({cache: false});
        </script>
    </head>
    <body>
        <div id="layout">
            <jsp:include page="/jsp/indice/header.jsp"></jsp:include>
            <div id="contenido">
                <div id="izquierda"><ul id='lista_izq'>&nbsp;</ul></div>
                <div id="centro">
                    <jsp:include page="/jsp/termycondi/nuevo.jsp"></jsp:include>
                </div>
                <div id="derecha">
                    <fieldset>
                        <form action="" id="activi_mes" method="post">
                            <table>
                                <tr>
                                    <td id="cal1"></td>
                                </tr>
                                <tr>
                                    <td>
                                        <input type="hidden" name="desde" readonly="readonly"/>
                                        <input type="hidden" name="hasta" readonly="readonly"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td><input type="submit" value="Ver" id="ver"/></td>
                                </tr>
                            </table>
                        </form>
                        <script type="text/javascript">//<![CDATA[
                            var now = new Date();
                            var cal1 = Calendar.setup({ 
                                cont: "cal1", 
                                date: now,
                                onSelect : updateFields
                            });
                            var desde = '01/' + ("0" + (now.getMonth() + 1)).slice(-2) + '/' + now.getFullYear();
                            $('input[name=desde]').val(desde);
                            var hasta = '01/' + ("0" + (now.getMonth() + 2)).slice(-2) + '/' + now.getFullYear();
                            $('input[name=hasta]').val(hasta);
                            function updateFields(cal) {
                                var date = cal.selection.get();
                                if (date) {
                                    date = Calendar.intToDate(date);
                                    desde = '01/' + Calendar.printDate(date, "%m") + '/' + date.getFullYear();
                                    $('input[name=desde]').val(desde);
                                    hasta = '01/' + ("0" + (parseInt(Calendar.printDate(date, "%m")) + 1)).slice(-2) + '/' + date.getFullYear();
                                    $('input[name=hasta]').val(hasta);
                                    $("#activi_mes").submit();
                                }
                            };
                            $("#activi_mes").submit(function() {
                                $.post('acti', $("#activi_mes").serialize(), function(data) {
                                    $("#centro").html(data);
                                });
                                $("#centro").html('<p><img src="images/loading.gif" /><br/>Guardando...</p>');
                                return false;
                            } );
                            //]]></script>
                    </fieldset>
                </div>
            </div>
            <jsp:include page="/jsp/indice/footer.jsp"></jsp:include>
        </div>
    </body>
</html>
